package com.Pounds.dao.Impl;

import com.Pounds.mapper.UserMapper;
import com.Pounds.pojo.User;
import com.Pounds.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class UserDaoImpl implements UserDao {
    // 暂且分配，后续需要改进为动态分配模式，即从控制类中获取需要响应的表
    private final String userDataBase = "UserData_1";

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> findAll() { return userMapper.findAll(); }

    @Override
    public String getUserPassword(String account) { return userMapper.getUserPassword(userDataBase, account);  }

    @Override
    public List<User> findUserAccount(String account) { return userMapper.findUserAccount(userDataBase, account);  }

    @Override
    public int newUser(String username, String account, String password) { return userMapper.newUser(userDataBase, username, account, password);  }
}
